<?php $this->renderPartial('index'); ?>

<table class="dataGrid">
  <tr>
    <th><?php echo $sort->link('id'); ?></th>
    <th><?php echo $sort->link('role'); ?></th>
    <th><?php echo $sort->link('username'); ?></th>
<!--    <th><?php echo $sort->link('email'); ?></th> -->
    <th><?php echo $sort->link('uploaded'); ?></th>
    <th><?php echo $sort->link('downloaded'); ?></th>
    <th><?php echo $sort->link('ratio'); ?></th>
    <th>Actions</th>
  </tr>
<?php foreach($users as $n => $user): ?>
  <tr class="<?php echo (($n & 1) == 0) ? 'even' : 'odd' ; ?>">
    <td><?php echo CHtml::encode($user->id); ?></td>
    <td><?php echo CHtml::image('/images/'.$user->role.'.png', $user->role); ?></td>
    <td><?php echo CHtml::link(CHtml::encode($user->username), '/admin/user/details/'.$user->id); ?></td>
<!--    <td><?php echo CHtml::encode($user->email); ?></td> -->
    <td><?php echo Misc::dataSizeHumanReadable($user->uploaded); ?></td>
    <td><?php echo Misc::dataSizeHumanReadable($user->downloaded); ?></td>
    <td><?php echo CHtml::encode($user->getRatio()); ?></td>
    <td>
	<?php echo CHtml::imageLink('/admin/user/edit/'.$user->id, '/images/edit.png'); ?>
	<?php echo CHtml::imageLink('/admin/user/permissions/'.$user->id, '/images/permissions.png'); ?>
	<?php echo CHtml::linkButton(CHtml::image('/images/delete.png'),
		array(
		   'submit'=>array('/admin/user/delete','id'=>$user->id),
		   'confirm'=>"Are you sure to delete this user?",
		)); ?>
<!--	<?php echo CHtml::imageLink('/user/delete/'.$user->id, '/images/delete.png'); ?> -->
	</td>
  </tr>
<?php endforeach; ?>
</table>

<br/>
<?php $this->widget('CLinkPager',array('pages'=>$pages)); ?>